
package com.market.web.action;

import com.market.bean.Product;
import com.market.bean.Scroll;

public class AdminScrAddAction extends BaseAction2
{
    public String execute() throws Exception
    {
        String productid = getRequest().getParameter("productid");
        String[] id = productid.split(",");
        
        logger.debug("product;" + productid + "length:" + id.length);
        for (int i = 0; i < id.length; i++)
        {
            long proid = 0;
            try
            {
                proid = Long.parseLong(id[i]);
            }
            catch (Exception e)
            {
                logger.error("",e);
                
            }
            Product pro = getProductService().findById(proid);
            if (pro != null)
            {
                Scroll scr = new Scroll();
                scr.setProduct(pro);
                try
                {
                    getScrollService().saveOrUpdate(scr);
                }
                catch (Exception e)
                {
                    logger.error("",e);
                  
                }
            }
        }
        return SUCCESS;//new ActionForward("/adminScroll.do");
    }
}
